class code5 {
    List<List<Integer>> ret;
    List<Integer> path;
    int n;

    public List<List<Integer>> subsets(int[] nums) {
        ret = new ArrayList<>();
        path = new ArrayList<>();
        n = nums.length;
        dfs(nums, 0);
        return ret;
    }

    public void dfs(int[] nums, int pos) {
        ret.add(new ArrayList<>(path));
        for (int i = pos; i < n; i++) {
            path.add(nums[i]);
            dfs(nums,i+1);
            path.remove(path.size() - 1);
        }
    }
}